import request from "@/utils/request";
import { praseStrEmpty } from "@/utils/enjoy";
// 查询进料清单列表
export function listInventory(params) {
  return request({
    url: "/ny-iqc/inventory/list",
    method: "get",
    params,
  });
}

// 查询进料清单分组列表
export function listInventoryGroup(params) {
  return request({
    url: "/ny-iqc/inventory/grouplist",
    method: "get",
    params,
  });
}

// 数据置顶
export function inventoryTop(params) {
  return request({
    url: "/ny-iqc/inventory/top",
    method: "get",
    params,
  });
}

// 审批
export function inventoryApprove(params) {
  return request({
    url: "/ny-iqc/inventory/approve",
    method: "post",
    params,
  });
}

// 审批校验
export function approveCheck(params) {
  return request({
    url: "/ny-iqc/inventory/approveCheck",
    method: "post",
    params,
  });
}

// 不合格评审单列表
export function listUnqualified(params) {
  return request({
    url: "/ny-iqc/unqualified/list",
    method: "get",
    params,
  });
}
// 不合格评审单详情
export function exportUnqualified(query) {
  return request({
    url: "/ny-iqc/unqualified/export",
    method: "get",
    params: query,
  });
}
// 不合格评审单导出
export function getUnqualifiedById(id) {
  return request({
    url: "/ny-iqc/unqualified/selectone/" + id,
    method: "get",
  });
}

// 破坏性台账列表
export function listDestroy(query) {
  return request({
    url: "/ny-iqc/destroy/list",
    method: "get",
    params: query,
  });
}
// 免检清单列表
export function getExemptionList(params) {
  return request({
    url: "/ny-iqc/exemption/list",
    method: "post",
    params,
  });
}
// 新增免检清单
export function addExemption(data) {
  return request({
    url: "/ny-iqc/exemption/add",
    method: "post",
    data,
  });
}

// 修改免检清单
export function UpdateExemption(data) {
  return request({
    url: "/ny-iqc/exemption/edit",
    method: "post",
    data,
  });
}

// 删除免检清单
export function deleteExemption(ids) {
  return request({
    url: "/ny-iqc/exemption/delete/" + ids,
    method: "get",
  });
}

// 额外检验单列表
export function listExtra(params) {
  return request({
    url: "/ny-iqc/extra/list",
    method: "get",
    params,
  });
}

// 新增额外检验单
export function addExtra(data) {
  return request({
    url: "/ny-iqc/extra/add",
    method: "post",
    data,
  });
}

// 删除额外检验单
export function deleteExtra(ids) {
  return request({
    url: "/ny-iqc/extra/delete/" + ids,
    method: "delete",
  });
}
// 额外检验单详情
export function getExtraInfo(id) {
  return request({
    url: "/ny-iqc/extra/selectone/" + id,
    method: "get",
  });
}
// 额外检验单回显校验
export function editEcho(id) {
  return request({
    url: "/ny-iqc/extra/editEcho/" + id,
    method: "get",
  });
}
// 新增额外检验单
export function editExtra(data) {
  return request({
    url: "/ny-iqc/extra/edit",
    method: "post",
    data,
  });
}

// 待检任务发起来料检验
export function checkoutIncoming(data) {
  return request({
    url: "/ny-iqc/inventory/checkout",
    method: "post",
    data,
  });
}

// 查询库存检验单详情
export function getStock(id) {
  return request({
    url: "/ny-iqc/repertory/selectone/" + id,
    method: "get",
  });
}

// 发起库存检验
export function addStock(data) {
  return request({
    url: "/ny-iqc/repertory/edit",
    method: "post",
    data,
  });
}

// 库存检验校对
export function proofread(params) {
  return request({
    url: "/ny-iqc/repertory/proofread",
    method: "post",
    params,
  });
}

// 库存检验更新有效期
export function updateValidityDate(params) {
  return request({
    url: "/ny-iqc/repertory/updateValidityDate",
    method: "post",
    params,
  });
}
// 待检任务发起检验校验
export function getInspectionCheck(params) {
  return request({
    url: "/ny-iqc/inventory/getInspectionCheck",
    method: "get",
    params,
  });
}
// 待检任务批量检验
export function getBatch(params) {
  return request({
    url: "/ny-iqc/inventory/getBatch",
    method: "get",
    params,
  });
}

// 新增库存检验单——校验
export function addCheckValied(params) {
  return request({
    url: "/ny-iqc/repertory/addCheck",
    method: "get",
    params,
  });
}

// 新增库存检验单
export function addCheckInspection(data) {
  return request({
    url: "/ny-iqc/repertory/add",
    method: "post",
    data,
  });
}

// 发起额外检验单
export function getProofread(params) {
  return request({
    url: "/ny-iqc/extra/ewSubmit",
    method: "post",
    params,
  });
}

// 修改免检单状态
export function updateStatus(data) {
  return request({
    url: "/ny-iqc/exemption/updateStatus",
    method: "post",
    data,
  });
}

/**
 * save split inspection  
 */
export function splitInspection(data){
  return request({
    url: "/ny-iqc/extra/extraSplit",
    method: "post",
    data,
  });
}
/**
 * get splititems to show and to recover
 * @param {*} id  
 * @returns 
 */
export function getSplitItemsInfo(id)
{
  return request({
    url: "/ny-iqc/extra/recoverCheck/"+id,
    method: "get",
  });
}

/**
 * recover split
 */
export function recoverSplit(id)
{
  //ny-iqc/extra/recover/
  return request({
    url: "/ny-iqc/extra/recover/"+id,
    method: "get",
  });
}